package com.test.pages;

import com.test.base.InitAppium;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.appium.java_client.pagefactory.AppiumFieldDecorator;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

/**
 * 首页
 * Created by xuedonglei on 2017/4/28.
 */
public class HomePage {


    // facebook登录
    @AndroidFindBy(id = "btn_facebook")
    @CacheLookup
    public AndroidElement btnFacebook;
    // 用户注册
    @AndroidFindBy(id = "btn_register")
    @CacheLookup
    public AndroidElement btnRegister;
    // 邮箱登录
    @AndroidFindBy(id = "btn_email_login")
    @CacheLookup
    public AndroidElement btnEmailLogin;

    public HomePage(AndroidDriver driver){
        PageFactory.initElements(new AppiumFieldDecorator(driver),this);
    }

    public void clickButton(WebElement element){
        element.click();
    }
}
